
package com.bdtop.dbl.server.request;

import com.bdtop.dbl.server.response.LogListResponse;
import com.bdtop.dbl.thirdparty.asynchttp.HttpPostRequest;
import com.bdtop.dbl.thirdparty.asynchttp.RequestCallback;
import com.bdtop.dbl.utils.Constants;
import com.bdtop.dbl.utils.DBLDebug;
import com.google.gson.Gson;

/**
 * @ClassName: GetLogListRequest
 * @Description: TODO
 * @author: liyongqiang
 * @date:2014-10-30
 */
public class GetLogListRequest extends HttpPostRequest {

    /**
     * @param callback
     */
    public GetLogListRequest(RequestCallback callback) {
        super(callback);
        getRequestParams().add(Constants.COMMAND, Constants.CMD_GET_LOG);
    }

    public void setParams(String sign, String startTime,String endTime) {
        getRequestParams().add(Constants.PARAM_LOGIN_SIGN, sign);
        getRequestParams().add(Constants.PARAM_UTC1, startTime);
        getRequestParams().add(Constants.PARAM_UTC2, endTime);

    }

    @Override
    public Object parse(String responseString) {
        DBLDebug.logd("GetLogListRequest response = " + responseString);

        Gson gson = new Gson();
        LogListResponse response = gson.fromJson(responseString, LogListResponse.class);

        return response;
    }

    @Override
    protected String getUrl() {
        return Constants.SERVER_ADDRESS;
    }

}
